package com.tiancheng.trade.settlement.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * 结算汇总删除状态
 */
@Getter
@AllArgsConstructor
public enum SettleSummaryDataStatus{
    INVALID(0, "无效"),
    EFFECTIVE(1, "有效"),
    PARTIALLY_EFFECTIVE(2, "有效，但仍需重新对账");

    private Integer code;
    private String desc;

    public static String getDesc(int code) {
        Optional<SettleSummaryDataStatus> found = Arrays.stream(SettleSummaryDataStatus.values()).filter(c -> c.getCode().equals(code)).findFirst();
        if (found.isPresent()) {
            return found.get().getDesc();
        }
        return "";
    }
}
